<!DOCTYPE html>
<html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>支付宝uid</title>
</head>
<style>

</style>
<body>
<div>
    <h1>测试代码</h1>
    <p><a th:href="${installMddSjbApp}">已注册企业微信，去授权</a></p>
    <p><a th:href="${registerQywx}">未注册企业微信，去注册</a></p>
    <p><a th:href="${toLogin}">去登录</a></p>
</div>
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $.ajax({
            type:'POST',
            data:JSON.stringify({"jssdkUrl":"https://mpsaas.syni.com/sjbApi/community/base#/login/toQywxLogin"}), //参数
            headers: {
                'qwtoken': "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJ7XCJjb3JwaWRcIjpcInd3MWM5ODZhN2QzZDg4ODBmOFwiLFwicXh3eEFkbWluSWRcIjoxLFwicXh5eFVzZXJpZFwiOlwiQ2hlbkZvWGluXCJ9IiwiZXhwIjoxNjE3MjQxMDkyfQ.AlQwlREp0zxZ__H2tbMybJXxtSpqM4QH8EfubxtzkZs",
            },
            contentType: 'application/json',
            url: "https://mpsaas.syni.com/sjbApi/community/base/common/wxConfig",
            success: function(result) {
                console.log(result);
                var resultData = result.data;
                wx.agentConfig({
                    corpid: resultData.corpid, // 必填，企业微信的corpid，必须与当前登录的企业一致
                    agentid: resultData.agentid, // 必填，企业微信的应用id （e.g. 1000247）
                    timestamp: resultData.timestamp, // 必填，生成签名的时间戳
                    nonceStr: resultData.nonceStr, // 必填，生成签名的随机串
                    signature: resultData.signature,// 必填，签名，见附录-JS-SDK使用权限签名算法
                    jsApiList: ['selectExternalContact'], //必填
                    success: function(res) {
                        // 回调
                        console.log(res);
                    },
                    fail: function(res) {
                        if(res.errMsg.indexOf('function not exist') > -1){
                            alert('版本过低请升级')
                        }
                    }
                });

            },
            error:function(data){
                alert('响应失败！');
            }
        });
    });
</script>
</body>
</html>